<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑题目</title>
    <link rel="stylesheet" th:href="@{/static/css/layui.css}">
    <style>
        #gb{
            width: 600px;
            margin: 0px auto;
        }
        .layui-form{
            margin-top: 0;
            margin-left: -30px;
            padding: 20px;
            width: 600px;
        }
    </style>
</head>
<body>
    <script th:if="${session.tUser.URole eq '0'}">window.location.href="/index"</script>
    <div id="gb">


        <form class="layui-form" method="post" >

            <input type="hidden" name="uId" th:value="${session.tUser.UId}">
            <input type="hidden" name="qId" th:value="${question.QId}">

            <div class="layui-form-item">
                <label class="layui-form-label">题目</label>
                <div class="layui-input-block">
                    <textarea name="qTitle" id="qTitle" th:text="${question.QTitle}" required lay-verify="required" placeholder="请输入题目" class="layui-textarea" style="resize: none"></textarea>
                </div>
            </div>


            <!--题目类型  1表示单选  2表示多选  3表示简答-->
            <div class="layui-form-item">
                <label class="layui-form-label">题目类型</label>
                <div class="layui-input-inline">
                    <select class="qType" lay-filter="Select" name="qType">
                        <option value="1" th:selected="${question.QType eq '1'}">单选题</option>
                        <option value="2" th:selected="${question.QType eq '2'}">多选题</option>
                        <option value="3" th:selected="${question.QType eq '3'}">简答题</option>
                    </select>
                </div>
            </div>

            <!--选择题choices-->
            <div class="layui-form-item choices">

                <div class="layui-form-item">
                    <label class="layui-form-label">选项A</label>
                    <div class="layui-input-block">
                        <input type="text" name="qAnswer1" th:value="${question.QAnswer1}" placeholder="请输入A选项内容" autocomplete="off" class="layui-input qAnswer1">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">选项B</label>
                    <div class="layui-input-block">
                        <input type="text" name="qAnswer2" th:value="${question.QAnswer2}" placeholder="请输入B选项内容" autocomplete="off" class="layui-input qAnswer2">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">选项C</label>
                    <div class="layui-input-block">
                        <input type="text" name="qAnswer3" th:value="${question.QAnswer3}" placeholder="请输入C选项内容" autocomplete="off" class="layui-input qAnswer3">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">选项D</label>
                    <div class="layui-input-block">
                        <input type="text" name="qAnswer4" th:value="${question.QAnswer4}"  placeholder="请输入D选项内容" autocomplete="off" class="layui-input qAnswer4">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">正确答案</label>
                    <!--单选题答案singleSelection-->
                    <div class="layui-input-block singleSelection">
                        <input type="radio" name="singleResult" class="singleResult" th:checked="${question.QResult eq 'A'}" value="A" title="A">
                        <input type="radio" name="singleResult" class="singleResult" th:checked="${question.QResult eq 'B'}" value="B" title="B">
                        <input type="radio" name="singleResult" class="singleResult" th:checked="${question.QResult eq 'C'}" value="C" title="C">
                        <input type="radio" name="singleResult" class="singleResult" th:checked="${question.QResult eq 'D'}" value="D" title="D">
                    </div>
                    <!--多选题答案multipleSelection-->
                    <div class="layui-input-block multipleSelection" hidden>
                        <input type="hidden" class="mr" th:value="${question.QResult}">
                        <input type="checkbox" name="multipleResult" class="multipleResult" value="A" title="A">
                        <input type="checkbox" name="multipleResult" class="multipleResult" value="B" title="B">
                        <input type="checkbox" name="multipleResult" class="multipleResult" value="C" title="C">
                        <input type="checkbox" name="multipleResult" class="multipleResult" value="D" title="D">
                    </div>
                </div>

            </div>

            <!--答案解析-->
            <div class="layui-form-item">
                <label class="layui-form-label">题目解析</label>
                <div class="layui-input-block">
                    <textarea name="qAnalyze" id="qAnalyze" th:text="${question.QAnalyze}" placeholder="请输入解析" class="layui-textarea" style="resize: none"></textarea>
                </div>
            </div>

            <!--题目分值-->
            <div class="layui-form-item">
                <label class="layui-form-label">分值</label>
                <div class="layui-input-inline">
                    <input name="qScore" class="layui-input qScore" th:value="${question.QScore}" type="text" autocomplete="off" placeholder="请输入分值"  required lay-verify="required" >
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo" id="butt">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>

    </div>

    <script type="text/javascript" th:src="@{/static/js/jquery-3.2.1.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/layui.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/mouseClick.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/validation.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/admin/updateQuestion.js}"></script>
</body>
</html>